package com.zh.note.huawei.onehundred.响应报文时间;

/**
 * 题目：https://dream.blog.csdn.net/article/details/130877029
 */

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int C = scanner.nextInt();
        int min = Integer.MAX_VALUE;

        for (int i = 0; i < C; i++) {
            int T = scanner.nextInt();
            int M = scanner.nextInt();
            int respTime = calculateRespTime(T, M);
            min = Math.min(min, respTime);
        }

        System.out.println(min);
    }

    private static int calculateRespTime(int T, int M) {
        if (M >= 128) {
            int mant = M & 0x0f; //mat是M的低四位
            int exp = (M >> 4) & 0x7; //m的高5～7位
            M = (mant | 0x10) << (exp + 3);
        }
        return T + M;
    }
}

